package zx.x.modules.sys.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import zx.x.modules.sys.entity.OpinionFeedbackEntity;
import zx.x.modules.sys.service.OpinionFeedbackService;
import zx.x.common.utils.PageUtils;
import zx.x.common.utils.R;



/**
 * 
 *
 * @author x
 * @email x
 * @date 2022-02-25 15:44:24
 */
@RestController
@RequestMapping("/opinionfeedback")
public class OpinionFeedbackController {
    @Autowired
    private OpinionFeedbackService opinionFeedbackService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //  @RequiresPermissions("x:opinionfeedback:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = opinionFeedbackService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //  @RequiresPermissions("x:opinionfeedback:info")
    public R info(@PathVariable("id") Integer id){
		OpinionFeedbackEntity opinionFeedback = opinionFeedbackService.getById(id);

        return R.ok().put("opinionFeedback", opinionFeedback);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //   @RequiresPermissions("x:opinionfeedback:save")
    public R save(@RequestBody OpinionFeedbackEntity opinionFeedback){
		opinionFeedbackService.save(opinionFeedback);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //   @RequiresPermissions("x:opinionfeedback:update")
    public R update(@RequestBody OpinionFeedbackEntity opinionFeedback){
		opinionFeedbackService.updateById(opinionFeedback);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //  @RequiresPermissions("x:opinionfeedback:delete")
    public R delete(@RequestBody Integer[] ids){
		opinionFeedbackService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
